﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using DAL;
using OOAD_PROJEKAT;
using kamera;


namespace Main_application
{
    /// <summary>
    /// Interaction logic for tehnickiPregled.xaml
    /// </summary>
    public partial class tehnickiPregled : Window
    {
        DAL.DAL.KlijentDAO k = new DAL.DAL.KlijentDAO();
        DAL.DAL.AutomobilDAO aa = new DAL.DAL.AutomobilDAO();

        List<Klijent> klijenti = new List<Klijent>();
        List<Automobil> automobili = new List<Automobil>();

        public tehnickiPregled()
        {
            InitializeComponent();

            klijenti = k.getAll();

            foreach (Klijent i in klijenti)
            {
                comboVlasnik.Items.Add(i.Jmbg);
            }

            List<String> vozila = new List<string>();
            vozila.Add("Putnicko");
            vozila.Add("Transportno");
            vozila.Add("Luksuzno");

            foreach (String i in vozila)
            {
                comboTip.Items.Add(i);
            }
        }

         
        private void Button_Click_1(object sender, RoutedEventArgs e)//Unos automobila
        {
            if (pro.Text == "" || reg.Text == "" || comboTip.Text == "" || comboVlasnik.Text == "" || snaga.Text == "" || datum.Text == "")
                MessageBox.Show("Niste unjeli sve podatke");

            
            //datePicker datum ide na mjesto drugog argumenta
            Automobil a = new Automobil(reg.Text, DateTime.Now, Convert.ToDouble(snaga), false, comboTip.Items[comboTip.SelectedIndex].ToString(), pro.Text, klijenti[comboVlasnik.SelectedIndex].Id);
            aa.create(a);
            MessageBox.Show("Uspjesno se unijeli automobil");
           
        }

        private void Button_Click_2(object sender, RoutedEventArgs e)//Unos pregleda
        {
            automobili = aa.getAll();

            /*foreach (Automobil i in automobili)
            {
                comboAuto.Items.Add(i.RegistarskeOznake);
            }
            Automobil a = new Automobil(automobili[0]);
            aa.update(new Automobil())*/
           
            

        }

        private void Button_Click_3(object sender, RoutedEventArgs e)//Video nadzor
        {
            kamera.MainWindow prozor = new kamera.MainWindow();
            prozor.ShowDialog();
        }
    }
}
